nfc7spi 2.2.2
Loading...
Searching...
No Matches
NFC 7 SPI Click Driver

API for configuring and manipulating NFC 7 SPI Click driver. More...

Topics

 NFC 7 SPI Registers List
 List of registers of NFC 7 SPI Click driver.
 NFC 7 SPI Registers Settings
 Settings for registers of NFC 7 SPI Click driver.
 NFC 7 SPI MikroBUS Map
 MikroBUS pin mapping of NFC 7 SPI Click driver.

Functions

void nfc7spi_cfg_setup (nfc7spi_cfg_t *cfg)
 NFC 7 SPI configuration object setup function.
err_t nfc7spi_init (nfc7spi_t *ctx, nfc7spi_cfg_t *cfg)
 NFC 7 SPI initialization function.
err_t nfc7spi_default_cfg (nfc7spi_t *ctx)
 NFC 7 SPI default configuration function.
void nfc7spi_enable_device (nfc7spi_t *ctx)
 NFC 7 SPI enable device function.
void nfc7spi_disable_device (nfc7spi_t *ctx)
 NFC 7 SPI disable device function.
void nfc7spi_reset_device (nfc7spi_t *ctx)
 NFC 7 SPI reset device function.
uint8_t nfc7spi_get_irq_pin (nfc7spi_t *ctx)
 NFC 7 SPI get IRQ pin function.
err_t nfc7spi_tx (nfc7spi_t *ctx, uint8_t *data_in, uint16_t len)
 NFC 7 SPI TX function.
err_t nfc7spi_rx (nfc7spi_t *ctx, uint8_t *data_out, uint16_t *len, uint16_t timeout)
 NFC 7 SPI RX function.
err_t nfc7spi_trx (nfc7spi_t *ctx, uint8_t *data_in, uint16_t in_len, uint8_t *data_out, uint16_t *out_len)
 NFC 7 SPI TRX function.
err_t nfc7spi_pkt_ctrl_tx (nfc7spi_t *ctx, nfc7spi_pkt_ctrl_t *pkt)
 NFC 7 SPI packet control TX function.
err_t nfc7spi_pkt_ctrl_rx (nfc7spi_t *ctx, nfc7spi_pkt_ctrl_t *pkt, uint16_t timeout)
 NFC 7 SPI packet control RX function.
err_t nfc7spi_pkt_ctrl_trx (nfc7spi_t *ctx, nfc7spi_pkt_ctrl_t *pkt)
 NFC 7 SPI packet control TRX function.
err_t nfc7spi_pkt_data_tx (nfc7spi_t *ctx, nfc7spi_pkt_data_t *pkt)
 NFC 7 SPI packet data TX function.
err_t nfc7spi_pkt_data_rx (nfc7spi_t *ctx, nfc7spi_pkt_data_t *pkt, uint16_t timeout)
 NFC 7 SPI packet data RX function.
err_t nfc7spi_pkt_data_trx (nfc7spi_t *ctx, nfc7spi_pkt_data_t *pkt)
 NFC 7 SPI packet data TRX function.
err_t nfc7spi_core_reset (nfc7spi_t *ctx)
 NFC 7 SPI core reset function.
err_t nfc7spi_core_init (nfc7spi_t *ctx)
 NFC 7 SPI core init function.
err_t nfc7spi_core_standby (nfc7spi_t *ctx, uint8_t mode)
 NFC 7 SPI core standby function.
err_t nfc7spi_core_total_duration (nfc7spi_t *ctx)
 NFC 7 SPI core total duration function.
err_t nfc7spi_core_tag_detector (nfc7spi_t *ctx)
 NFC 7 SPI core tag detector function.
err_t nfc7spi_core_clock_sel (nfc7spi_t *ctx)
 NFC 7 SPI core clock sel function.
err_t nfc7spi_core_pmu (nfc7spi_t *ctx)
 NFC 7 SPI core PMU function.
err_t nfc7spi_core_rf_config (nfc7spi_t *ctx)
 NFC 7 SPI core RF config function.
err_t nfc7spi_config_settings (nfc7spi_t *ctx)
 NFC 7 SPI config settings function.
err_t nfc7spi_map_rf_interface (nfc7spi_t *ctx)
 NFC 7 SPI map RF interface function.
err_t nfc7spi_start_discovery (nfc7spi_t *ctx)
 NFC 7 SPI start discovery function.
err_t nfc7spi_stop_discovery (nfc7spi_t *ctx)
 NFC 7 SPI stop discovery function.
err_t nfc7spi_wait_discovery (nfc7spi_t *ctx, nfc7spi_rf_intf_t *rf_intf)
 NFC 7 SPI wait discovery function.
void nfc7spi_presence_check (nfc7spi_t *ctx, nfc7spi_rf_intf_t *rf_intf)
 NFC 7 SPI presence check function.
err_t nfc7spi_reader_act_next (nfc7spi_t *ctx, nfc7spi_rf_intf_t *rf_intf)
 NFC 7 SPI reader activate next function.
err_t nfc7spi_reader_re_act (nfc7spi_t *ctx, nfc7spi_rf_intf_t *rf_intf)
 NFC 7 SPI reader reactivate next function.
err_t nfc7spi_reader_tag_cmd (nfc7spi_t *ctx, nfc7spi_pkt_data_t *pkt)
 NFC 7 SPI reader tag cmd function.

Detailed Description

API for configuring and manipulating NFC 7 SPI Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ nfc7spi_cfg_setup()

void nfc7spi_cfg_setup ( nfc7spi_cfg_t * cfg)

NFC 7 SPI configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See nfc7spi_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ nfc7spi_config_settings()

err_t nfc7spi_config_settings ( nfc7spi_t * ctx)

NFC 7 SPI config settings function.

This function sets the default core config settings.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_core_clock_sel()

err_t nfc7spi_core_clock_sel ( nfc7spi_t * ctx)

NFC 7 SPI core clock sel function.

This function sets the core clock selection to NFC7SPI_NCI_CORE_CLOCK_SEL_XTAL.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_core_init()

err_t nfc7spi_core_init ( nfc7spi_t * ctx)

NFC 7 SPI core init function.

This function resets and initializes the device core.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_core_pmu()

err_t nfc7spi_core_pmu ( nfc7spi_t * ctx)

NFC 7 SPI core PMU function.

This function sets the core power management unit to NFC7SPI_NCI_CORE_PMU_IRQ_EN_TVDD_3V3.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_core_reset()

err_t nfc7spi_core_reset ( nfc7spi_t * ctx)

NFC 7 SPI core reset function.

This function resets the device core and reads the FW version.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_core_rf_config()

err_t nfc7spi_core_rf_config ( nfc7spi_t * ctx)

NFC 7 SPI core RF config function.

This function sets the core RF config to NFC7SPI_NCI_CORE_RF_CONF.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_core_standby()

err_t nfc7spi_core_standby ( nfc7spi_t * ctx,
uint8_t mode )

NFC 7 SPI core standby function.

This function sets the core standby mode.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in]mode:
  • 0 - Standby mode disabled,
  • 1 - Standby mode enabled,
  • 2 - Autonomous mode enabled.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_core_tag_detector()

err_t nfc7spi_core_tag_detector ( nfc7spi_t * ctx)

NFC 7 SPI core tag detector function.

This function sets the core tag detector to NFC7SPI_NCI_CORE_TAG_DETECTOR_DIS.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_core_total_duration()

err_t nfc7spi_core_total_duration ( nfc7spi_t * ctx)

NFC 7 SPI core total duration function.

This function sets the core total duration of the single discovery period to NFC7SPI_NCI_CORE_TOTAL_DURATION_510MS.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_default_cfg()

err_t nfc7spi_default_cfg ( nfc7spi_t * ctx)

NFC 7 SPI default configuration function.

This function executes a default configuration of NFC 7 SPI Click board.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ nfc7spi_disable_device()

void nfc7spi_disable_device ( nfc7spi_t * ctx)

NFC 7 SPI disable device function.

This function disables the device by setting the VEN pin to LOW logic state.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ nfc7spi_enable_device()

void nfc7spi_enable_device ( nfc7spi_t * ctx)

NFC 7 SPI enable device function.

This function enables the device by setting the VEN pin to HIGH logic state.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ nfc7spi_get_irq_pin()

uint8_t nfc7spi_get_irq_pin ( nfc7spi_t * ctx)

NFC 7 SPI get IRQ pin function.

This function returns the IRQ pin logic state.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ nfc7spi_init()

err_t nfc7spi_init ( nfc7spi_t * ctx,
nfc7spi_cfg_t * cfg )

NFC 7 SPI initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See nfc7spi_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_map_rf_interface()

err_t nfc7spi_map_rf_interface ( nfc7spi_t * ctx)

NFC 7 SPI map RF interface function.

This function enables all RF protocols and interface in poll mode.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_pkt_ctrl_rx()

err_t nfc7spi_pkt_ctrl_rx ( nfc7spi_t * ctx,
nfc7spi_pkt_ctrl_t * pkt,
uint16_t timeout )

NFC 7 SPI packet control RX function.

This function waits a desired period for a NCI control packet response to arrive and reads it.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[out]pkt: NCI control packet data structure read. See nfc7spi_pkt_ctrl_t object definition for detailed explanation.
[in]timeout: Waiting data timeout in milliseconds.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_pkt_ctrl_trx()

err_t nfc7spi_pkt_ctrl_trx ( nfc7spi_t * ctx,
nfc7spi_pkt_ctrl_t * pkt )

NFC 7 SPI packet control TRX function.

This function sends a NCI control packet using nfc7spi_pkt_ctrl_tx function and reads the response using nfc7spi_pkt_ctrl_rx with a 1 second timeout.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in,out]pkt: NCI control packet data structure to write (response packet is populated here). See nfc7spi_pkt_ctrl_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_pkt_ctrl_tx()

err_t nfc7spi_pkt_ctrl_tx ( nfc7spi_t * ctx,
nfc7spi_pkt_ctrl_t * pkt )

NFC 7 SPI packet control TX function.

This function sends a desired NCI control packet data.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in]pkt: NCI control packet data structure to be sent. See nfc7spi_pkt_ctrl_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_pkt_data_rx()

err_t nfc7spi_pkt_data_rx ( nfc7spi_t * ctx,
nfc7spi_pkt_data_t * pkt,
uint16_t timeout )

NFC 7 SPI packet data RX function.

This function waits a desired period for a NCI data packet response to arrive and reads it.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[out]pkt: NCI data packet data structure read. See nfc7spi_pkt_data_t object definition for detailed explanation.
[in]timeout: Waiting data timeout in milliseconds.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_pkt_data_trx()

err_t nfc7spi_pkt_data_trx ( nfc7spi_t * ctx,
nfc7spi_pkt_data_t * pkt )

NFC 7 SPI packet data TRX function.

This function sends a NCI data packet using nfc7spi_pkt_data_tx function and reads the response using nfc7spi_pkt_data_rx with a 1 second timeout.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in,out]pkt: NCI data packet data structure to write (response packet is populated here). See nfc7spi_pkt_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_pkt_data_tx()

err_t nfc7spi_pkt_data_tx ( nfc7spi_t * ctx,
nfc7spi_pkt_data_t * pkt )

NFC 7 SPI packet data TX function.

This function sends a desired NCI data packet data.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in]pkt: NCI data packet data structure to be sent. See nfc7spi_pkt_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_presence_check()

void nfc7spi_presence_check ( nfc7spi_t * ctx,
nfc7spi_rf_intf_t * rf_intf )

NFC 7 SPI presence check function.

This function waits until the discovered target device is removed.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in]rf_intf: Filled with discovered NFC remote device properties.
Returns
None.
Note
None.

◆ nfc7spi_reader_act_next()

err_t nfc7spi_reader_act_next ( nfc7spi_t * ctx,
nfc7spi_rf_intf_t * rf_intf )

NFC 7 SPI reader activate next function.

This function performs activation of the next tag (in case of multiple tag detection or multi-protocol tag).

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in,out]rf_intf: Filled with discovered NFC remote device properties.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_reader_re_act()

err_t nfc7spi_reader_re_act ( nfc7spi_t * ctx,
nfc7spi_rf_intf_t * rf_intf )

NFC 7 SPI reader reactivate next function.

This function performs reactivation of the current tag.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in]rf_intf: Filled with discovered NFC remote device properties.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_reader_tag_cmd()

err_t nfc7spi_reader_tag_cmd ( nfc7spi_t * ctx,
nfc7spi_pkt_data_t * pkt )

NFC 7 SPI reader tag cmd function.

This function performs RAW data packet transceive operation (send then receive) with the remote tag.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in,out]pkt: NCI data packet data structure to write (response packet is populated here). See nfc7spi_pkt_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_reset_device()

void nfc7spi_reset_device ( nfc7spi_t * ctx)

NFC 7 SPI reset device function.

This function resets the device by toggling the VEN pin.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ nfc7spi_rx()

err_t nfc7spi_rx ( nfc7spi_t * ctx,
uint8_t * data_out,
uint16_t * len,
uint16_t timeout )

NFC 7 SPI RX function.

This function waits a desired period for a data received flag and reads the data by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[out]data_out: Output read data.
[out]len: Number of bytes read.
[in]timeout: Waiting data timeout in milliseconds.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_start_discovery()

err_t nfc7spi_start_discovery ( nfc7spi_t * ctx)

NFC 7 SPI start discovery function.

This function starts RF discovery for NFC-A, NFC-B, NFC-F, and NFC-V technologies.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_stop_discovery()

err_t nfc7spi_stop_discovery ( nfc7spi_t * ctx)

NFC 7 SPI stop discovery function.

This function stops the RF discovery process.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_trx()

err_t nfc7spi_trx ( nfc7spi_t * ctx,
uint8_t * data_in,
uint16_t in_len,
uint8_t * data_out,
uint16_t * out_len )

NFC 7 SPI TRX function.

This function sends data using nfc7spi_tx function and reads the response using nfc7spi_rx with a 1 second timeout.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]in_len: Number of bytes to be written.
[out]data_out: Output read data.
[out]out_len: Number of bytes read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_tx()

err_t nfc7spi_tx ( nfc7spi_t * ctx,
uint8_t * data_in,
uint16_t len )

NFC 7 SPI TX function.

This function writes a desired number of data bytes by using SPI serial interface.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ nfc7spi_wait_discovery()

err_t nfc7spi_wait_discovery ( nfc7spi_t * ctx,
nfc7spi_rf_intf_t * rf_intf )

NFC 7 SPI wait discovery function.

This function waits until remote NFC device is discovered.

Parameters
[in]ctx: Click context object. See nfc7spi_t object definition for detailed explanation.
[out]rf_intf: Filled with discovered NFC remote device properties.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.